<?php
require 'includes/config.php';
require 'includes/auth.php';
// Make request to kill the session (delete accesstoken)
$request = new makeRequest($backend.'login.php?method=logout&id='.$_SESSION['uid'].'&accesstoken='.$_SESSION['accesstoken'], 'GET');
$request = $request->makeRequest();
$rbody = $request[0];
$http_code = $request [1];
$userobj = json_decode($rbody);
// Check for successful request
if($http_code == 200){
	// Kill the session at clientside
	unset($_SESSION);
	session_destroy();
	header('location: login.php');
}else{ // If logout fails ?
	echo "Failed to logout"; 
}
?>
